{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "subjective-alignment",
   "metadata": {},
   "outputs": [],
   "source": [
    "import glob\n",
    "import os\n",
    "\n",
    "import netCDF4 as nc4\n",
    "import numpy as np\n",
    "\n",
    "from src.loader import get_most_frequent_label\n",
    "from src.metrics import hist1D_per_class\n",
    "\n",
    "import seaborn as sns\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "confident-lyric",
   "metadata": {},
   "outputs": [],
   "source": [
    "channel = \"cloud_water_path\"\n",
    "bins = np.linspace(0, 5000, 1000)\n",
    "\n",
    "data_paths = glob.glob(\"../DATA/nc/*.nc\")\n",
    "prediction_dir = \"results/lgbm/predicted-label-masks/\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "accurate-freeze",
   "metadata": {},
   "outputs": [],
   "source": [
    "def load_files():\n",
    "    \n",
    "    for nc_file in data_paths:\n",
    "\n",
    "        base = os.path.basename(nc_file)\n",
    "        base_npy = base.replace(\".nc\", \".npy\")\n",
    "\n",
    "        predictions = np.load(os.path.join(prediction_dir, base_npy))\n",
    "\n",
    "        file = nc4.Dataset(nc_file, 'r', format='NETCDF4')\n",
    "\n",
    "        properties = file.variables[channel][0]\n",
    "        rois = file.variables[\"cloud_mask\"][0]\n",
    "        labels = file.variables[\"cloud_layer_type\"][0]\n",
    "\n",
    "        file.close()\n",
    "\n",
    "        yield properties, rois.data, labels.data, predictions"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "listed-correspondence",
   "metadata": {},
   "outputs": [],
   "source": [
    "hists, counts = hist1D_per_class(load_files, bins)\n",
    "# normalize histograms\n",
    "hists[\"target\"] = np.divide(hists[\"target\"], counts[\"target\"], out=np.zeros_like(hists[\"target\"]), where= counts[\"target\"] > 0)\n",
    "hists[\"pred\"] = np.divide(hists[\"pred\"], counts[\"pred\"], out=np.zeros_like(hists[\"pred\"]), where= counts[\"pred\"] > 0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "framed-diagram",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'target': array([[0.        , 0.02202643, 0.03964758, ..., 0.        , 0.        ,\n",
       "         0.        ],\n",
       "        [0.        , 0.        , 0.01652893, ..., 0.        , 0.        ,\n",
       "         0.        ],\n",
       "        [0.        , 0.        , 0.07017544, ..., 0.        , 0.        ,\n",
       "         0.        ],\n",
       "        ...,\n",
       "        [0.        , 0.        , 0.        , ..., 0.        , 0.        ,\n",
       "         0.        ],\n",
       "        [0.        , 0.        , 0.        , ..., 0.        , 0.        ,\n",
       "         0.        ],\n",
       "        [0.        , 0.        , 0.        , ..., 0.        , 0.        ,\n",
       "         0.        ]]),\n",
       " 'pred': array([[6.07358564e-03, 3.41948545e-02, 5.45053305e-02, ...,\n",
       "         7.24339372e-06, 3.62169686e-06, 8.45062601e-06],\n",
       "        [1.46957520e-03, 5.60693038e-03, 1.01158543e-02, ...,\n",
       "         4.17492955e-06, 0.00000000e+00, 4.17492955e-06],\n",
       "        [1.40566659e-03, 2.17146204e-02, 3.43363350e-02, ...,\n",
       "         0.00000000e+00, 0.00000000e+00, 0.00000000e+00],\n",
       "        ...,\n",
       "        [5.54063517e-04, 1.12428722e-02, 3.04581028e-02, ...,\n",
       "         0.00000000e+00, 0.00000000e+00, 0.00000000e+00],\n",
       "        [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ...,\n",
       "         0.00000000e+00, 0.00000000e+00, 0.00000000e+00],\n",
       "        [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ...,\n",
       "         0.00000000e+00, 0.00000000e+00, 0.00000000e+00]])}"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hists"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "bizarre-marking",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/vale/.local/lib/python3.6/site-packages/seaborn/distributions.py:366: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison\n",
      "  and estimate_kws[\"bins\"] == \"auto\"\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<matplotlib.legend.Legend at 0x7fca191166a0>"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAW0AAAFgCAYAAABwnyj8AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAAAsTAAALEwEAmpwYAAAxsElEQVR4nO3de5ScdZ3n8fe3qvoSkhAwhFvCbIIwQiKOQmRAXEdlHaOjZHfFIQGUDFe57I7jzu6BM2fc1RnOWWfmjLOzyiXIHRUY1DORZWSV+yUkNAoDCQYjwhpEEkK4BKjqqt/z3T/qqc6TSnV3dXc9XfVUfV7n9Omqp56q/j3V1d/+Pt/f5TF3R0REsiHX7gaIiEjzFLRFRDJEQVtEJEMUtEVEMkRBW0QkQwrtbsB0WLZsmf/oRz9qdzNEpHdZq16oJzLtl19+ud1NEBFpiZ4I2iIi3UJBW0QkQxS0RUQypCc6IkVk+pXLZbZs2UKxWGx3U6bN4OAgCxYsoK+vL7WfoaAtIqnYsmULs2fPZuHChZi1bPBEx3J3tm/fzpYtW1i0aFFqP0flERFJRbFYZO7cuT0RsAHMjLlz56Z+ZqGgLSKp6ZWAXTMdx6ugLSKSIQraItJzrrvuOn7zm9+0uxmToqAtIj0ny0Fbo0dEpKv91V/9FTfddBPz5s3jkEMO4ZhjjmFoaIjTTjuNGTNmsHbtWmbMmNHuZjZNQVtEUveVH25g429eb+lrLj54b/77p5eMuc+jjz7K9773PZ544gnK5TJHH300xxxzDEuXLuXv/u7vWLp0aUvbNB0UtEWkaz300EMsX76cwcFBBgcH+fSnP93uJk2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mCC\n",
      "text/plain": [
       "<Figure size 360x360 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# plot target and prediction histograms for class 7\n",
    "cl = 7\n",
    "sns.displot(x=bins[1:], bins=bins, kde=False, weights=hists[\"pred\"][cl], label=\"lgbm\") # plot histogram for preditions\n",
    "sns.kdeplot(x=bins[1:], weights=hists[\"target\"][cl], hue_norm=False, label=\"gt\") # plot density for ground-truth\n",
    "\n",
    "plt.xlim(0, 5000)\n",
    "plt.legend()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "experimental-montgomery",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
